import { TableColumnObject } from 'amis/lib/renderers/Table'

class YesOrNoColumnUtils {
	getSchema = (parmas: Partial<TableColumnObject>): TableColumnObject => {
		const { name, label } = parmas

		const mergeSchema = Object.assign(
			{
				name: name,
				label: label,
				type: 'mapping',
				map: {
					true: '是',
					false: '否',
					'1': '是',
					'0': '否',
					'*': `\${${name}}`,
				},
			} as TableColumnObject,
			parmas,
		)

		const schema = mergeSchema as TableColumnObject
		return schema
	}
}

export default new YesOrNoColumnUtils()
